package com.xquant.trade.risk.entity;

import com.xquant.common.core.annotation.Excel;
import org.apache.commons.lang.StringUtils;

import java.math.BigDecimal;

public class CombinedMonitorDetail implements Cloneable {

    // 金融工具，如场外期权、收益互换、对冲的持仓

    private String tradeId;
    @Excel(name = "产品编号",sort = 1)
    private String extTradeId;
    @Excel(name = "合约编号",sort = 2)
    private String iCode;

    private String aType;
    private String mType;
    private String iName;
    // 挂钩标的，如挂钩股指期货、指数、股票等
    @Excel(name = "标的代码",sort = 5)
    private String uICode;

    private String uAType;
    private String uMType;
    @Excel(name = "标的名称",sort = 6)
    private String uIName;
    private String uInstrument;
    // 穿透后的标的，如沪深300指数，中证500指数，股票
    private String uuICode;
    private String uuAType;
    private String uuMType;
    private String uuIName;

    private String pCalc;
    private String pCalcInit;
    private String pCalcPricing;
    private String pCalcInstrument;

    private String partyId;
    @Excel(name = "交易对手",sort = 31)
    private String partyName;

    private String groupId;
    private String groupName;
    @Excel(name = "期权类型",dictType = "optionType",sort = 3)
    private String productType;
    private String initProductType;
    private String tradeType;
    @Excel(name = "买卖方向",dictType = "payDirection",sort = 7)
    private String payDirection;

    private String ls;
    private double lotSize;
    private double price;
    private double priceOffset;
    private double volOffset;
    @Excel(name = "名义本金",cellType = Excel.ColumnType.MONEY,scale = 2,width = 30,sort = 26)
    private double volume;
    private double cost;
    @Excel(name = "浮动盈亏(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 36)
    private double plFloat;
    //风险Greek
    @Excel(name = "npv",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 37)
    private double npv;
    @Excel(name = "delta",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 38)
    private double delta;
    @Excel(name = "gamma",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 40)
    private double gamma;
    @Excel(name = "vega",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 43)
    private double vega;
    @Excel(name = "rho",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 44)
    private double rho;
    @Excel(name = "theta",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 42)
    private double theta;
    @Excel(name = "deltacash",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 39)
    private double cashDelta;
    @Excel(name = "gammacash",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 41)
    private double cashGamma;

    private String errInfo;
    private String errCode;
    private String groupInfo;
    private String sceneID;
    private double spotPriceInc;
    private double volSurfaceInc;
    @Excel(name = "起始日",sort = 21)
    private String issueDate;
    @Excel(name = "到期日",sort = 22)
    private String maturityDate;
    private double marginCost;
    private String dimAccId;
    private String productName;

    private String accId;
    @Excel(name = "本方账户",sort = 32)
    private String accName;
    private String accIdCp;
    private String accNameCp;
    private String tradeStatus;

    //收益相关字段
    @Excel(name = "收益率(%)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 33)
    private double yield; // ADD,UPDATE,DELETE
    @Excel(name = "已实现收益率(%)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 34)
    private double realizedYield;
    @Excel(name = "历史盈亏率",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 35)
    private double hisYield;
    private double premium;
    private double exerciseAmount;

    private String operateDate;//操作日期
    private String calcDate;//计算日期
    private String calcTime;//计算时间
    private Long calcBy; //计算人

    private double calcPrice;//计算标的价格
    @Excel(name = "期初价格",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 25)
    private double openingPrice;

    private double uPrice;
    private String instrument;
    @Excel(name = "行权方式",dictType = "exerciseType",sort = 9)
    private String exerciseType;

    private String eventStatus;
    private String eventExercise;

    //新增的交易要素
    @Excel(name = "交易日期",sort = 4)
    private String tradeDate;
    @Excel(name = "涨跌类型",dictType = "callPut",sort = 8)
    private String optionType;
    @Excel(name = "高行权价(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 10)
    private BigDecimal strikePrice = BigDecimal.ZERO;
    @Excel(name = "低行权价(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 11)
    private BigDecimal lowStrikePrice = BigDecimal.ZERO;

    @Excel(name = "收益率1(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 12)
    private BigDecimal yield1 = BigDecimal.ZERO;
    @Excel(name = "收益率2(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 13)
    private BigDecimal yield2 = BigDecimal.ZERO;
    @Excel(name = "收益率3(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 14)
    private BigDecimal yield3 = BigDecimal.ZERO;
    @Excel(name = "障碍价1(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 15)
    private BigDecimal triggerPrice1 = BigDecimal.ZERO;
    @Excel(name = "障碍价2(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 16)
    private BigDecimal triggerPrice2 = BigDecimal.ZERO;
    @Excel(name = "期权费(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 17)
    private BigDecimal frontOptionFee = BigDecimal.ZERO;
    private BigDecimal frontOptionFeeRate = BigDecimal.ZERO;
    private String frontOptionFeeYear = "1";
    @Excel(name = "期权费支付日",sort = 18)
    private String frontOptionFeePaydate;
    @Excel(name = "前端费(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 19)
    private BigDecimal frontFee = BigDecimal.ZERO;
    private BigDecimal frontFeeRate = BigDecimal.ZERO;
    private String frontFeeYear = "1";
    @Excel(name = "前端费支付日",sort = 20)
    private String frontFeePaydate;
    @Excel(name = "到期支付日",sort = 23)
    private String paymentDate;

    @Excel(name = "提前终止费(元)",cellType = Excel.ColumnType.MONEY,scale = 2,sort = 24)
    private BigDecimal terminateFee = BigDecimal.ZERO;

    @Excel(name = "参与率1(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 27)
    private BigDecimal participationRate1 = BigDecimal.ZERO;
    @Excel(name = "参与率2(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 28)
    private BigDecimal participationRate2 = BigDecimal.ZERO;
//    @Excel(name = "固定利率(%)",cellType = Excel.ColumnType.PERCENT,scale = 2,sort = 29)
    private BigDecimal fixedRate = BigDecimal.ZERO;
    @Excel(name = "期权状态",dictType = "durationStatus",sort = 30)
    private String duEventStatus;



    public String getOperateDate() {
        return operateDate;
    }

    public void setOperateDate(String operateDate) {
        this.operateDate = operateDate;
    }

    public String getPartyId() {
        return partyId;
    }

    public void setPartyId(String partyId) {
        this.partyId = partyId;
    }

    public String getPartyName() {
        return partyName;
    }

    public void setPartyName(String partyName) {
        this.partyName = partyName;
    }

    public String getTradeId() {
        return tradeId;
    }

    public void setTradeId(String tradeId) {
        this.tradeId = tradeId;
    }

    public String getiCode() {
        return iCode;
    }

    public void setiCode(String iCode) {
        this.iCode = iCode;
    }

    public String getaType() {
        return aType;
    }

    public void setaType(String aType) {
        this.aType = aType;
    }

    public String getmType() {
        return mType;
    }

    public void setmType(String mType) {
        this.mType = mType;
    }

    public String getiName() {
        return iName;
    }

    public void setiName(String iName) {
        this.iName = iName;
    }

    public String getCalcDate() {
        return calcDate;
    }

    public void setCalcDate(String calcDate) {
        this.calcDate = calcDate;
    }

    public Long getCalcBy() {
        return calcBy;
    }

    public void setCalcBy(Long calcBy) {
        this.calcBy = calcBy;
    }

    public String getCalcTime() {
        return calcTime;
    }

    public void setCalcTime(String calcTime) {
        this.calcTime = calcTime;
    }

    public String getuICode() {
        return uICode;
    }

    public void setuICode(String uICode) {
        this.uICode = uICode;
    }

    public String getuAType() {
        return uAType;
    }

    public void setuAType(String uAType) {
        this.uAType = uAType;
    }

    public String getuMType() {
        return uMType;
    }

    public void setuMType(String uMType) {
        this.uMType = uMType;
    }

    public String getuIName() {
        return uIName;
    }

    public void setuIName(String uIName) {
        this.uIName = uIName;
    }

    public String getUuICode() {
        return uuICode;
    }

    public void setUuICode(String uuICode) {
        this.uuICode = uuICode;
    }

    public String getUuAType() {
        return uuAType;
    }

    public void setUuAType(String uuAType) {
        this.uuAType = uuAType;
    }

    public String getUuMType() {
        return uuMType;
    }

    public void setUuMType(String uuMType) {
        this.uuMType = uuMType;
    }

    public String getUuIName() {
        return uuIName;
    }

    public void setUuIName(String uuIName) {
        this.uuIName = uuIName;
    }

    public String getpCalc() {
        return pCalc;
    }

    public void setpCalc(String pCalc) {
        this.pCalc = pCalc;
    }

    public String getpCalcInit() {
        return pCalcInit;
    }

    public void setpCalcInit(String pCalcInit) {
        this.pCalcInit = pCalcInit;
    }

    public String getpCalcPricing() {
        return pCalcPricing;
    }

    public void setpCalcPricing(String pCalcPricing) {
        this.pCalcPricing = pCalcPricing;
    }

    public String getpCalcInstrument() {
        return pCalcInstrument;
    }

    public void setpCalcInstrument(String pCalcInstrument) {
        this.pCalcInstrument = pCalcInstrument;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getInitProductType() {
        return initProductType;
    }

    public void setInitProductType(String initProductType) {
        this.initProductType = initProductType;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getPayDirection() {
        return payDirection;
    }

    public void setPayDirection(String payDirection) {
        this.payDirection = payDirection;
    }

    public String getLs() {
        return ls;
    }

    public void setLs(String ls) {
        this.ls = ls;
    }

    public double getLotSize() {
        return lotSize;
    }

    public void setLotSize(double lotSize) {
        this.lotSize = lotSize;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getPriceOffset() {
        return priceOffset;
    }

    public void setPriceOffset(double priceOffset) {
        this.priceOffset = priceOffset;
    }

    public double getVolOffset() {
        return volOffset;
    }

    public void setVolOffset(double volOffset) {
        this.volOffset = volOffset;
    }

    public double getVolume() {
        return volume;
    }

    public void setVolume(double volume) {
        this.volume = volume;
    }

    public double getCost() {
        return cost;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }

    public double getPlFloat() {
        return plFloat;
    }

    public void setPlFloat(double plFloat) {
        this.plFloat = plFloat;
    }

    public double getNpv() {
        return npv;
    }

    public void setNpv(double npv) {
        this.npv = npv;
    }

    public double getDelta() {
        return delta;
    }

    public void setDelta(double delta) {
        this.delta = delta;
    }

    public double getGamma() {
        return gamma;
    }

    public BigDecimal getFrontOptionFeeRate() {
        return frontOptionFeeRate;
    }

    public CombinedMonitorDetail setFrontOptionFeeRate(BigDecimal frontOptionFeeRate) {
        this.frontOptionFeeRate = frontOptionFeeRate;
        return this;
    }

    public String getFrontOptionFeeYear() {
        return frontOptionFeeYear;
    }

    public CombinedMonitorDetail setFrontOptionFeeYear(String frontOptionFeeYear) {
        this.frontOptionFeeYear = frontOptionFeeYear;
        return this;
    }

    public BigDecimal getFrontFeeRate() {
        return frontFeeRate;
    }

    public CombinedMonitorDetail setFrontFeeRate(BigDecimal frontFeeRate) {
        this.frontFeeRate = frontFeeRate;
        return this;
    }

    public String getFrontFeeYear() {
        return frontFeeYear;
    }

    public CombinedMonitorDetail setFrontFeeYear(String frontFeeYear) {
        this.frontFeeYear = frontFeeYear;
        return this;
    }

    public void setGamma(double gamma) {
        this.gamma = gamma;
    }

    public double getVega() {
        return vega;
    }

    public void setVega(double vega) {
        this.vega = vega;
    }

    public double getRho() {
        return rho;
    }

    public void setRho(double rho) {
        this.rho = rho;
    }

    public double getTheta() {
        return theta;
    }

    public void setTheta(double theta) {
        this.theta = theta;
    }

    public double getCashDelta() {
        return cashDelta;
    }

    public void setCashDelta(double cashDelta) {
        this.cashDelta = cashDelta;
    }

    public double getCashGamma() {
        return cashGamma;
    }

    public void setCashGamma(double cashGamma) {
        this.cashGamma = cashGamma;
    }

    public String getErrInfo() {
        return errInfo;
    }

    public void setErrInfo(String errInfo) {
        this.errInfo = errInfo;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getGroupInfo() {
        return groupInfo;
    }

    public void setGroupInfo(String groupInfo) {
        this.groupInfo = groupInfo;
    }

    public String getSceneID() {
        return sceneID;
    }

    public void setSceneID(String sceneID) {
        this.sceneID = sceneID;
    }

    public double getSpotPriceInc() {
        return spotPriceInc;
    }

    public void setSpotPriceInc(double spotPriceInc) {
        this.spotPriceInc = spotPriceInc;
    }

    public double getVolSurfaceInc() {
        return volSurfaceInc;
    }

    public void setVolSurfaceInc(double volSurfaceInc) {
        this.volSurfaceInc = volSurfaceInc;
    }

    public String getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(String issueDate) {
        this.issueDate = issueDate;
    }

    public String getMaturityDate() {
        return maturityDate;
    }

    public void setMaturityDate(String maturityDate) {
        this.maturityDate = maturityDate;
    }

    public double getMarginCost() {
        return marginCost;
    }

    public void setMarginCost(double marginCost) {
        this.marginCost = marginCost;
    }

    public String getDimAccId() {
        return dimAccId;
    }

    public void setDimAccId(String dimAccId) {
        this.dimAccId = dimAccId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getAccId() {
        return accId;
    }

    public void setAccId(String accId) {
        this.accId = accId;
    }

    public String getAccName() {
        return accName;
    }

    public void setAccName(String accName) {
        this.accName = accName;
    }

    public String getAccIdCp() {
        return accIdCp;
    }

    public void setAccIdCp(String accIdCp) {
        this.accIdCp = accIdCp;
    }

    public String getAccNameCp() {
        return accNameCp;
    }

    public void setAccNameCp(String accNameCp) {
        this.accNameCp = accNameCp;
    }

    public String getTradeStatus() {
        return tradeStatus;
    }

    public void setTradeStatus(String tradeStatus) {
        this.tradeStatus = tradeStatus;
    }

    public double getYield() {
        return yield;
    }

    public void setYield(double yield) {
        this.yield = yield;
    }

    public double getRealizedYield() {
        return realizedYield;
    }

    public void setRealizedYield(double realizedYield) {
        this.realizedYield = realizedYield;
    }

    public double getHisYield() {
        return hisYield;
    }

    public void setHisYield(double hisYield) {
        this.hisYield = hisYield;
    }

    public double getPremium() {
        return premium;
    }

    public void setPremium(double premium) {
        this.premium = premium;
    }

    public double getExerciseAmount() {
        return exerciseAmount;
    }

    public void setExerciseAmount(double exerciseAmount) {
        this.exerciseAmount = exerciseAmount;
    }

    public double getuPrice() {
        return uPrice;
    }

    public void setuPrice(double uPrice) {
        this.uPrice = uPrice;
    }

    public double getCalcPrice() {
        return calcPrice;
    }

    public void setCalcPrice(double calcPrice) {
        this.calcPrice = calcPrice;
    }

    public String getInstrument() {
        return instrument;
    }

    public void setInstrument(String instrument) {
        this.instrument = instrument;
    }

    public String getExerciseType() {
        return exerciseType;
    }

    public void setExerciseType(String exerciseType) {
        this.exerciseType = exerciseType;
    }


    public String getEventStatus() {
        return eventStatus;
    }

    public void setEventStatus(String eventStatus) {
        this.eventStatus = eventStatus;
    }

    public String getEventExercise() {
        return eventExercise;
    }

    public void setEventExercise(String eventExercise) {
        this.eventExercise = eventExercise;
    }

    public String getUInstrument() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.uICode);
        sb.append(",");
        sb.append(this.uAType);
        sb.append(",");
        sb.append(this.uMType);
        return sb.toString();
    }

    public void setUInstrument(String uCode) {
        if (StringUtils.isEmpty(uCode)) {
            this.uICode = null;
            this.uAType = null;
            this.uMType = null;
        } else {
            String[] u = uCode.split(",");
            this.uICode = u[0];
            this.uAType = u[1];
            this.uMType = u[2];
        }
    }

    public String getUuCode() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.uuICode);
        sb.append(",");
        sb.append(this.uuAType);
        sb.append(",");
        sb.append(this.uuMType);
        return sb.toString();
    }

    public void setUuCode(String uuCode) {
        if (StringUtils.isEmpty(uuCode)) {
            this.uuICode = null;
            this.uuAType = null;
            this.uuMType = null;
        } else {
            String[] u = uuCode.split(",");
            this.uuICode = u[0];
            this.uuAType = u[1];
            this.uuMType = u[2];
        }
    }

    public String getExtTradeId() {
        return extTradeId;
    }

    public void setExtTradeId(String extTradeId) {
        this.extTradeId = extTradeId;
    }

    public String getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(String tradeDate) {
        this.tradeDate = tradeDate;
    }

    public String getOptionType() {
        return optionType;
    }

    public void setOptionType(String optionType) {
        this.optionType = optionType;
    }

    public BigDecimal getStrikePrice() {
        return strikePrice;
    }

    public void setStrikePrice(BigDecimal strikePrice) {
        this.strikePrice = strikePrice;
    }

    public BigDecimal getLowStrikePrice() {
        return lowStrikePrice;
    }

    public void setLowStrikePrice(BigDecimal lowStrikePrice) {
        this.lowStrikePrice = lowStrikePrice;
    }

    public BigDecimal getYield1() {
        return yield1;
    }

    public void setYield1(BigDecimal yield1) {
        this.yield1 = yield1;
    }

    public BigDecimal getYield2() {
        return yield2;
    }

    public void setYield2(BigDecimal yield2) {
        this.yield2 = yield2;
    }

    public BigDecimal getYield3() {
        return yield3;
    }

    public void setYield3(BigDecimal yield3) {
        this.yield3 = yield3;
    }

    public BigDecimal getTriggerPrice1() {
        return triggerPrice1;
    }

    public void setTriggerPrice1(BigDecimal triggerPrice1) {
        this.triggerPrice1 = triggerPrice1;
    }

    public BigDecimal getTriggerPrice2() {
        return triggerPrice2;
    }

    public void setTriggerPrice2(BigDecimal triggerPrice2) {
        this.triggerPrice2 = triggerPrice2;
    }

    public BigDecimal getFrontOptionFee() {
        return frontOptionFee;
    }

    public void setFrontOptionFee(BigDecimal frontOptionFee) {
        this.frontOptionFee = frontOptionFee;
    }

    public String getFrontOptionFeePaydate() {
        return frontOptionFeePaydate;
    }

    public void setFrontOptionFeePaydate(String frontOptionFeePaydate) {
        this.frontOptionFeePaydate = frontOptionFeePaydate;
    }

    public BigDecimal getFrontFee() {
        return frontFee;
    }

    public void setFrontFee(BigDecimal frontFee) {
        this.frontFee = frontFee;
    }

    public String getFrontFeePaydate() {
        return frontFeePaydate;
    }

    public void setFrontFeePaydate(String frontFeePaydate) {
        this.frontFeePaydate = frontFeePaydate;
    }

    public String getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(String paymentDate) {
        this.paymentDate = paymentDate;
    }

    public BigDecimal getTerminateFee() {
        return terminateFee;
    }

    public void setTerminateFee(BigDecimal terminateFee) {
        this.terminateFee = terminateFee;
    }

    public BigDecimal getParticipationRate1() {
        return participationRate1;
    }

    public void setParticipationRate1(BigDecimal participationRate1) {
        this.participationRate1 = participationRate1;
    }

    public BigDecimal getParticipationRate2() {
        return participationRate2;
    }

    public void setParticipationRate2(BigDecimal participationRate2) {
        this.participationRate2 = participationRate2;
    }

    public BigDecimal getFixedRate() {
        return fixedRate;
    }

    public void setFixedRate(BigDecimal fixedRate) {
        this.fixedRate = fixedRate;
    }

    public String getDuEventStatus() {
        return duEventStatus;
    }

    public void setDuEventStatus(String duEventStatus) {
        this.duEventStatus = duEventStatus;
    }

    public double getOpeningPrice() {
        return openingPrice;
    }

    public void setOpeningPrice(double openingPrice) {
        this.openingPrice = openingPrice;
    }

    @Override
    public CombinedMonitorDetail clone() {
        CombinedMonitorDetail ret = null;
        try {
            ret = (CombinedMonitorDetail) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return ret;
    }
}
